import request from '@/utils/request'

//获取员工简单列表
export function getEmployeeSimple() {
  return request({
    url: '/sys/user/simple'
  })
}

//获取员工综合列表
export function getEmployeeList(params) {
  return request({
    url: '/sys/user',
    params
  })
}

//删除员工
export function deleteEmployee(id) {
  return request({
    url: `/sys/user/${id}`,
    method: 'delete'
  })
}

//新增员工
export function addEmployee(data) {
  return request({
    url: '/sys/user',
    method: 'post',
    data
  })
}

//id:获取资料的员工的基本信息
export function getUserInfoApi(id) {
  return request({
    url: `/sys/user/${id}`
  })
}

//保存员工的基本信息
export function saveUserDetailById(data) {
  return request({
    url: `/sys/user/${data.id}`,
    method: 'put',
    data
  })
}

//批量导入
export function addAllUserApi(data) {
  return request({
    url: '/sys/user/batch',
    method: 'post',
    data
  })
}

// 保存员工个人信息
export function setUserDetailApi(data) {
  return request({
    url: `/employees/${data.userId}/personalInfo`,
    method: 'PUT',
    data
  })
}

//获取员工给人信息
export function getPersonalDetail(id) {
  return request({
    url: ` /employees/${id}/personalInfo`
  })
}

// 获取员工岗位信息
export function getJobInfoApi(id) {
  return request({
    url: `/employees/${id}/jobs`
  })
}

//给员工分配角色
export function sysUserAssignRolesApi(data) {
  return request({
    url: '/sys/user/assignRoles',
    method: 'put',
    data
  })
}
